<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Sign in &middot; TECHDERA Dashboard</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="assets/css/bootstrap.css" rel="stylesheet">
    <script type="text/javascript" src="assets/js/jquery.min.js"></script>
    <style type="text/css">
      body {
        padding-top: 40px;
        padding-bottom: 40px;
        background-color: #f5f5f5;
      }

      .form-signin {
        max-width: 300px;
        padding: 19px 29px 29px;
        margin: 0 auto 20px;
        background-color: #fff;
        border: 1px solid #e5e5e5;
        -webkit-border-radius: 5px;
           -moz-border-radius: 5px;
                border-radius: 5px;
        -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
           -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
                box-shadow: 0 1px 2px rgba(0,0,0,.05);
      }
      .form-signin .form-signin-heading,
      .form-signin .checkbox {
        margin-bottom: 10px;
      }
      .form-signin input[type="text"],
      .form-signin input[type="password"] {
        font-size: 16px;
        height: auto;
        margin-bottom: 15px;
        padding: 7px 9px;
      }

    </style>
    <link href="assets/css/bootstrap-responsive.css" rel="stylesheet">

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Fav and touch icons -->
    
   <meta http-equiv="refresh" content="8,URL=login.php">
  </head>


  <body>

    <div class="container">
   

	    <div class="modal" id="loginModal">
	    
    <div class="modal-header">
    
    
        <!--<button type="button" class="close" data-dismiss="modal">?</button>-->
        <a href="login.php" class="btn btn-primary pull-right"><i class="icon-lock icon-white"></i>&nbsp;Login here!</a>
        <h3>Registration Status</h3>
        
        
    </div>
        <div class="modal-body" style="text-align:center;">
        <div class="row-fluid">
            <div class="span10 offset1">
                <div id="modalTab">
                    <div class="tab-content">
                       <?php

							include('../inc/config.inc');
							
							// Passkey that got from link 
							$passkey=$_GET['passkey'];
							$tbl_name1="temp_members";
							
							// Retrieve data from table where row that match this passkey 
							$sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$passkey'";
							$result1=mysql_query($sql1);
							
							// If successfully queried 
							if($result1){
							
							// Count how many row has this passkey
							$count=mysql_num_rows($result1);
							
							// if found this passkey in our database, retrieve data from table "temp_members_db"
							if($count==1){
							
							$rows=mysql_fetch_array($result1);
							$name=$rows['name'];
							$email=$rows['email'];
							$password=$rows['password']; 
							$country=$rows['country'];
							$tbl_name2="perm_members";
							
							// Insert data that retrieves from "temp_members_db" into table "registered_members" 
							$sql2="INSERT INTO $tbl_name2(name, email, password, country)VALUES('$name', '$email', '$password', '$country')";
							$result2=mysql_query($sql2);
							}
							
							// if not found passkey, display message "Wrong Confirmation code" 
							else {
							echo "<h4 class='text-error'>Wrong Confirmation code, Or the Confirmation code was expired.</h4>";
							}
							
							// if successfully moved data from table"temp_members_db" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db"
							if($result2){
							
							echo "<h4 class='text-success'>Congratulation! Your account has been activated</h4>";
							echo "<p class='lead'>You will redirected in few seconds to login page.</p>";
							
							// Delete information of this user from table "temp_members_db" that has this passkey 
							$sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'";
							$result3=mysql_query($sql3);
							
							}
							
							}
							?>
                           
                        
                     
                    </div>
                </div>
            </div>
        </div>
    </div><div class="clearfix"></div>
     
    </div> <!-- /container -->
    
    </div>
   
    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="assets/js/jquery.js"></script>
    <script src="assets/js/bootstrap-transition.js"></script>
    <script src="assets/js/bootstrap-alert.js"></script>
    <script src="assets/js/bootstrap-modal.js"></script>
    <script src="assets/js/bootstrap-dropdown.js"></script>
    <script src="assets/js/bootstrap-scrollspy.js"></script>
    <script src="assets/js/bootstrap-tab.js"></script>
    <script src="assets/js/bootstrap-tooltip.js"></script>
    <script src="assets/js/bootstrap-popover.js"></script>
    <script src="assets/js/bootstrap-button.js"></script>
    <script src="assets/js/bootstrap-collapse.js"></script>
    <script src="assets/js/bootstrap-carousel.js"></script>
    <script src="assets/js/bootstrap-typeahead.js"></script>

  </body>
</html>

<!-- Localized -->